<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>welcome</title>
    <script src="js/jquery.js"></script>
    <script src="js/jquery.cookie.js"></script>
</head>
<body>

<h1 align="right"></h1>

<script>
    $(function () {
        let token = $.cookie('mySession');
        if (token === null) {
            window.location.href = "/login.html"
        }
        $.ajax({
            type: "get",
            url: "/api/user/info/" + token,
            error: function () {
                console.log("未登录");
                window.location.href = "/login.html"
            },
            success: function (data) {
                if (data.length < 1) {
                    console.log("无用户信息");
                    window.location.href = "/login.html"
                } else {
                    $("h1").html(data + ",欢迎登录系统")
                }
            }
        })
    });
</script>

</body>
</html>